home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 49
/
Amiga Format CD49 (2000-01-17)(Future Publishing)(GB)(Track 1 of 3)[!][issue 2000-02].iso
/
-in_the_mag-
/
reader_requests
/
mpmorph4x
/
source
/
sd
/
agdoc2html.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1999-12-01
|
3KB
|
118 lines
/* Rexx program to convert makedoc guides to html
*
* No error checking!
*
* Relies on very specific format!
*
* $VER: AGDoc2HTML.rexx 1.0 (16.3.97)
*/
parse arg arg1
seealso = 0
call open('in',arg1,'r')
line = readln('in')
do while ~eof('in')
word1 = word(line,1)
if word1 = "@database" then do
end
else if word1 = "@rem" then do
end
else if word1 = "@node" then do
name = word(line,2)
if name ~= "main" then do
name = substr(name,2,length(name)-2)
title = arg1"/"name
end
else do
title = arg1
end
call WriteHeaders(name" "title)
seealso = 0
end
else if substr(line,1,2) = "@{" then do
call writech('out','<A HREF="')
index1 = index(line,"link")
index2 = index(line,"}")
len = length(line)
link = substr(line,index1+6,len-index1-7)
call writeln('out',link'.html">'link'</A>')
end
else if word1 = "@endnode" then do
call WriteTrailers
end
else do
if seealso then do
newline = ""
inlink = 0
link = ""
do i=1 to length(line) by 1
c = substr(line,i,1)
if inlink then do
if (c = " ") | (c = ",") | (c = ".") then do
if (index(link,"()") ~= 0) & (index(link,"/") = 0) then do
newline = newline||'<A HREF="'substr(link,1,length(link)-2)'.html">'link'</A>'
newline = newline||c
end
else do
newline = newline||link||c
end
inlink = 0
link = ""
end
else do
link = link||c
end
end
else do
if (c = " ") | (c = ",") | (c = ".") then do
newline = newline||c
end
else do
link = c
inlink = 1
end
end
end
if inlink then do
if (index(link,"()") ~= 0) & (index(link,"/") = 0) then do
newline = newline||'<A HREF="'substr(link,1,length(link)-2)'.html">'link'</A>'
end
else do
newline = newline||link||c
end
end
call writeln('out',newline)
end
else do
call writeln('out',line)
if index(line,"SEE ALSO") ~= 0 then do
seealso = 1
end
end
end
line = readln('in')
end
call close('in')
return
WriteHeaders: procedure
parse arg name title
say name
call open('out',name".html",'w')
call writeln('out',"<HTML>")
call writeln('out',"<HEAD>")
call writeln('out',"<TITLE>"title"</TITLE>")
call writeln('out',"</HEAD>")
call writeln('out',"<BODY>")
call writeln('out',"<H1>"title"</H1><P>")
call writeln('out',"<PRE>")
return
WriteTrailers: procedure
call writeln('out',"</PRE>")
call writeln('out',"</BODY>")
call writeln('out',"</HTML>")
call close('out')
return